package main

import (
	"encoding/json"
	"fmt"
)
type (
	LiveCurrentInfoReq struct {
		OwnerUid int64  `json:"owner_uid" schema:"owner_uid"` //房主uid
		LiveId   string `json:"live_id" schema:"live_id"`
	}

	LiveCurrentInfoResp struct {
		Uid               int64        `json:"uid" schema:"uid"`
		LiveTitle         string       `json:"live_title" schema:"live_title"`
		LiveCopyright     int          `json:"live_copyright" schema:"live_copyright"` //直播间的版权信息：1、大版权；2、小版权
		LiveID            string       `json:"live_id" schema:"live_id"`
		ProgramID         int64        `json:"program_id" schema:"program_id"` //节目id
		Name              string       `json:"name" schema:"name"`
		ProgramImage      string       `json:"program_image" schema:"program_image"`             //节目单对应的海报
		ProgramImageColor string       `json:"program_image_color" schema:"program_image_color"` //海报蒙层颜色
		Copyright         int          `json:"copyright" schema:"copyright"`                     //1、大版权；2、小版权
		CurrentTime       int64        `json:"current_time" schema:"current_time"`               //当前播放的进度，毫秒为单位
		TotalTime         int64        `json:"total_time" schema:"total_time"`                   //当前影片的总时长：毫秒
		StartTime         int64        `json:"start_time" schema:"start_time"`
		EndTime           int64        `json:"end_time" schema:"end_time"`
		DelayTime         int64        `json:"delay_time" schema:"delay_time"` //可以接受的误差时间：秒
		Time              string       `json:"time" schema:"time"`             //展示开始和结束的直观表达
		Definition        []Definition `json:"definition" schema:"definition"`
	}

	Definition struct { //清晰度
		ID        int    `json:"id" schema:"id"`
		StreamUrl string `json:"stream_url" schema:"stream_url"`
		Desc      string `json:"desc" schema:"desc"`
		DescWord  string `json:"desc_word" schema:"desc_word"` //高清、超清
	}
)
func main() {
	Unmarshal()
}

//解json
func Unmarshal()  {
	record := LiveCurrentInfoResp{}
	str := "{\"uid\":761972901,\"live_title\":\"\xe6\x9e\x97\xe6\xad\xa3\xe8\x8b\xb1\xe7\xb3\xbb\xe5\x88\x9710\",\"live_copyright\":2,\"live_id\":\"1674033541023148\",\"program_id\":1674033486752596,\"name\":\"1993 \xe8\xbf\xbd\xe9\xad\x82\xe4\xbc\x9e \",\"program_image\":\"https://img.ikstatic.cn/MTY3NDAxMzMyMjEyNiMxOTcjanBn.jpg\",\"program_image_color\":\"#000000\",\"copyright\":2,\"current_time\":2972000,\"total_time\":5241000,\"start_time\":1676971649,\"end_time\":1676976890,\"delay_time\":5000,\"time\":\"02\xe6\x9c\x8821\xe6\x97\xa5 17:27-18:54\",\"definition\":[{\"id\":53758,\"stream_url\":\"http://vod-filmlive.inke.cn/oE5LxkeHgSdfBq6qVkTcGTxCGrB3oBfZb8AAQV?auth_key=1676974860-8091bcbceb-761972901-d9a1ee0e3576c4861c2dced55b738af6\",\"desc\":\"360p\",\"desc_word\":\"\xe6\xa0\x87\xe6\xb8\x85\"},{\"id\":53759,\"stream_url\":\"http://vod-filmlive.inke.cn/o05cHBUkLXVfAfS6IQrbC1JAAG5ETg1VEROe35?auth_key=1676974860-b8402fa30c-761972901-482d08e6271b4ffc3396752e561fa64e\",\"desc\":\"540p\",\"desc_word\":\"\xe9\xab\x98\xe6\xb8\x85\"}]}\n"

	json.Unmarshal([]byte(str),&record)
	fmt.Println(record)
}
